/*
 * Copyright (c) 2020 - present, Inspur Genersoft Co., Ltd.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.inspur.edp.cef.generator.repository.dac;

import com.inspur.edp.caf.generator.baseInfo.TypeInfo;
import com.inspur.edp.caf.generator.method.ClassMethodGenerator;
import com.inspur.edp.cef.generator.repository.AssemblerInfo;
import com.inspur.edp.cef.generator.repository.dac.method.ChildEntityConstructorGenerator;
import com.inspur.edp.cef.generator.repository.repository.nestedrepository.DataTypeReposGenContext;
import com.inspur.edp.cef.repository.dac.ChildEntityDac;
import com.inspur.edp.das.commonmodel.IGspCommonObject;

import java.lang.reflect.InvocationTargetException;

public class ChildEntityDacGenerator extends EntityDacGenerator
{
	private String nodeCode;
	@Override
	protected final boolean getIsChildDac(){return true;}
	public ChildEntityDacGenerator(IGspCommonObject gspCommonObject, DataTypeReposGenContext reposContext, String nodeCode)
	{
		super(gspCommonObject, reposContext, nodeCode);
		this.gspCommonObject = gspCommonObject;
		this.nodeCode = nodeCode;
//		ExtendAssemblers = extendAssemblers;
	}

	@Override
	protected java.util.ArrayList<ClassMethodGenerator> createConstructorGenerators()
	{
		return new java.util.ArrayList<ClassMethodGenerator>(java.util.Arrays.asList(new ClassMethodGenerator[] { new ChildEntityConstructorGenerator(getName()) }));
	}
	@Override
	protected void initAssemblerType()
	{
	}
	@Override
	protected TypeInfo setParentClass()
	{
		return new TypeInfo(ChildEntityDac.class.getTypeName());
	}
	@Override
	protected void intiExtendAssemblerInfo() throws InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException {
		if (ExtendAssemblers == null || ExtendAssemblers.size() < 1)
		{
			return;
		}

		for (AssemblerInfo extendType : ExtendAssemblers)
		{
			initChildAssemblerInfo(extendType);

			initExtendChildAssemblerInfo(extendType);
		}
	}
	//TODO ParentJoin放到adaptor
	//protected override List<PropertyGenerator> createPropertyGenerators()
	//{
	//    var props = base.CreatePropertyGenerators();
	//    //1、ParentJoin
	//    props.Add();


	//    return props;

	//}

	@Override
	protected String getName()
	{
		return nodeCode + "dac";
	}
}
